#ifndef CUSTOMMESSAGEBOX_H
#define CUSTOMMESSAGEBOX_H

#include <QDebug>
#include <QMessageBox>
#include <QAbstractButton>
#include <QObject>

enum CMsg {
    CQuestion = 1,
    CWarning = 2,
    CCritical = 3,
    CInformation = 4,
    CNoButton = 0
};

class CustomMessageBox : public QMessageBox
{

    Q_OBJECT

public:
    explicit CustomMessageBox();
    ~CustomMessageBox();

public:
    int show(QWidget *parent = nullptr,
             CMsg msgType = CMsg::CQuestion,
             QString msgTitle = "",
             QString msgText = ""); // 提示框显示
    void normalShow(QWidget *parent = nullptr,
                    CMsg msgType = CMsg::CQuestion,
                    CMsg iconType = CMsg::CQuestion,
                    QString msgTitle = "",
                    QString msgText = ""); // 非事件循环式启动
    void initMsgBox(); // 初始化提示框
    void noDefaultButtons(); // 设置无默认按钮
    void normalHide();// 非事件循环式关闭

private:
    QMessageBox *_msgBox;
    QWidget *_parent;
    CMsg _msgType;
    QString _msgText;
    QString _msgTitle;

private:
    void changeButtonsFontType(); // 改变按钮文字类型
    void setNormalShowIcon(CMsg msgType, CMsg iconType); // 设置非事件循环式窗口图标

};

#endif // CUSTOMMESSAGEBOX_H
